package com.ruoyi.framework.web;

import com.ruoyi.common.core.domain.model.LoginUser;

/**
 * 用于当前线程存放用户信息
 * @author machi
 * @date 2023/12/17
 */
public class UserInfoUtil {
    private static final ThreadLocal<LoginUser> THREAD_LOCAL = new ThreadLocal<>();

    public static void setUser(LoginUser user) {
        THREAD_LOCAL.set(user);

    }

    public static LoginUser getUser() {
        return THREAD_LOCAL.get();
    }

    public static void remove(){
        THREAD_LOCAL.remove();
    }
}
